public interface PurchasingListener
Clients must implement the
PurchasingListener
and register an instance of their implementation with
PurchasingService.registerListener(android.content.Context,
PurchasingListener)
before using other APIs in the
PurchasingService.
Your registered implementation of
PurchasingListener
asynchronously receives callbacks when operations you initiate
via methods in the
PurchasingService
have completed.
For example, if you initiate a purchase with
PurchasingService.purchase(String), you will eventually receive a notification that the
PurchaseResponse
is available by your implemented
onPurchaseResponse(PurchaseResponse)
method.
Keep in mind that your UI thread invokes these callbacks. Execute time-intensive tasks on another thread.
| Modifier and Type | Method and Description |
|---|---|
void |
onProductDataResponse(ProductDataResponse productDataResponse)
This callback method is invoked when an
ProductDataResponse
is available for a request initiated by
PurchasingService.getProductData(java.util.Set).
|
void |
onPurchaseResponse(PurchaseResponse purchaseResponse)
This callback method is invoked when a
PurchaseResponse
is available for a purchase initiated by
PurchasingService.purchase(String).
|
void |
onPurchaseUpdatesResponse(PurchaseUpdatesResponse purchaseUpdatesResponse)
This callback method is invoked when a
PurchaseUpdatesResponse
is available for a request initiated by
PurchasingService.getPurchaseUpdates(boolean).
|
void |
onUserDataResponse(UserDataResponse userDataResponse)
This callback method is invoked when a
UserDataResponse
is available for a request initiated by
PurchasingService.getUserData().
|
void onUserDataResponse(UserDataResponse userDataResponse)
This callback method is invoked when a
UserDataResponse
is available for a request initiated by
PurchasingService.getUserData().
Implement this method to get the app-specific user ID and marketplace information of the currently logged-in user.
Keep in mind that the UI thread invokes this method. Execute time-intensive tasks on another thread.
userDataResponse - Response containing the
user data and status of the request.
void onProductDataResponse(ProductDataResponse productDataResponse)
This callback method is invoked when an
ProductDataResponse
is available for a request initiated by
PurchasingService.getProductData(java.util.Set).
Keep in mind that the UI thread invokes this method. Execute time-intensive tasks on another thread.
productDataResponse - Response containing
the product data and status of the request.
void onPurchaseResponse(PurchaseResponse purchaseResponse)
This callback method is invoked when a
PurchaseResponse
is available for a purchase initiated by
PurchasingService.purchase(String).
Implement this method to, for example, update your application state, save purchase information to a database, send information to your developer server.
Keep in mind that the UI thread invokes this method. Execute time-intensive tasks on another thread.
purchaseResponse - Response containing the
purchase data and status of the request.
void onPurchaseUpdatesResponse(PurchaseUpdatesResponse purchaseUpdatesResponse)
This callback method is invoked when a
PurchaseUpdatesResponse
is available for a request initiated by
PurchasingService.getPurchaseUpdates(boolean).
Keep in mind that the UI thread invokes this method. Execute time-intensive tasks on another thread.
purchaseUpdatesResponse - Response
containing the receipt data and status of the request.